// 文件路径：src/main/java/com/example/demo15/config/WebConfig.java
package com.example.demo15.config;

import com.example.demo15.interceptor.LoginInterceptor;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

@Configuration
public class WebConfig implements WebMvcConfigurer {

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(new LoginInterceptor())
                .addPathPatterns("/**")         // 拦截所有请求
                .excludePathPatterns("/", "/login", "/register", "/css/**", "/js/**","/login-process", "/images/**"); // 排除静态资源和登录注册页面
    }
}
